﻿using System;
using System.Windows.Forms;

namespace Voize
{
	internal partial class fUrl : Form
	{


		internal fUrl()
		{
			InitializeComponent();
            tFile.Enabled = false;
            bFile.Enabled = false;
		}



		private string m_Url;



		private void bOK_Click(object sender, EventArgs e)
		{
            if (cFile.Checked)
            {
                if (this.tFile.Text != "")
                {
                    this.DialogResult = DialogResult.OK;
                    m_Url = @"file://" + tFile.Text;
                    this.Close();
                }
            }
            else
            {
                if (this.tUrl.Text != "")
                {
                    this.DialogResult = DialogResult.OK;
                    m_Url = tUrl.Text;
                    this.Close();
                }
            }
		}



		private void bCancel_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
			this.Close();
		}



		internal string Url
		{
			get { return m_Url; }
		}



        private void cFile_CheckedChanged(object sender, EventArgs e)
        {
            if (cFile.Checked)
            {
                tUrl.Enabled = false;
                lUrl.Enabled = false;
                tFile.Enabled = true;
                bFile.Enabled = true;
            }
            else
            {
                tUrl.Enabled = true;
                lUrl.Enabled = true;
                tFile.Enabled = false;
                bFile.Enabled = false;
            }
        }

        private void bFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog od = new OpenFileDialog();
            od.AutoUpgradeEnabled = false;
            od.Title = "Select pls file...";
            od.Filter = "Pls|*.pls";

            if (od.ShowDialog() == DialogResult.OK)
            {
                tFile.Text = od.FileName;
            }
        }
	}
}
